package com.project.mapper;

import com.project.bean.RoomBean;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface IRoomMapper {
    /**
     * 查询所有
     * @return 房间集合
     */

    public List<RoomBean> findAll();
    /***
     * 添加房间
     * @param room
     */
    @Insert("INSERT INTO t_room(r_roomAddress,r_roomState,r_type,r_ceilingPeple) values(" +
            "#{address},#{statues},#{type},#{accPeople})")
    public void add(RoomBean room);

    /**
     * 按id删除房间
     * @param id 房间id
     */
    @Delete("delete from t_room where pk_roomId=#{id}")
    public void del(int id);

    /***
     * 按id查看房间信息，同时查询该房间所在学生
     * @param id 房间id
     * @return 房间对象
     */
    public RoomBean findById(int id);

    /***
     * 动态条件查询
     * @param address 房间地址
     * @param statues 房间状态
     * @param canRoom 可住房间
     * @param type 房间类型
     * @return 房间集合
     */
    public List<RoomBean> findByItem(@Param("address") String address, @Param("statues") String statues,@Param("canRoom") String canRoom,@Param("type") String type);
}
